package components.gameinfo
{
	import capricornus.components.ComponentsManager;
	import capricornus.components.window.WindowAlignType;
	
	import scene.Scene;
	import scene.event.SceneEvent;

	/**
	 * 游戏上面显示信息区 
	 * @author kael
	 * 
	 */	
	public class GameInfoController
	{
		public static var instance:GameInfoController;
		
		private var _view:GameInfoView;
		
		public function GameInfoController()
		{
			init();
		}
		
		private function init():void
		{
			instance = this;
			
			_view = new GameInfoView( ComponentsManager.instance.foreLayer );
			_view.setLocation( 0, 0 );
			_view.setAlignType( WindowAlignType.LEFT, WindowAlignType.TOP );
			_view.show();
			
			Scene.instance.addEventListener( SceneEvent.DEMON_COUNT_CHANGED, onDemonCountChanged, false, 0, true );
		}
		
		private function onDemonCountChanged( e:SceneEvent ):void
		{
			_view.txtDemonCount.text = e.data.toString();
		}
	}
}